package martin.tpfinal.grabar.principal;

import java.awt.Dimension;
import java.awt.Toolkit;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;

import javax.swing.JFrame;

import martin.tpfinal.grabar.grafico.VentanaPrincipal;
import martin.tpfinal.grabar.motor.MotorEjecucion;

import org.apache.log4j.Logger;
import org.apache.log4j.PropertyConfigurator;

public class Principal {
	
	
    private static final Logger logger = Logger.getLogger(Principal.class);
	
	public static void main(String[] args) {
		PropertyConfigurator.configure("log4j.properties");
		
		logger.info("Se inicializo el sistema que captura las palabras");
		
		//creo el motor de ejecucion////////////////////////
		MotorEjecucion motorEjecucion = new MotorEjecucion();
		new Thread(motorEjecucion).start();
		///////////////////////////////////////////////////
		
	    VentanaPrincipal capturePlayback = new VentanaPrincipal();
	    JFrame f = new JFrame("Capture/Playback");
	    f.addWindowListener(new WindowAdapter() {
	    	public void windowClosing(WindowEvent e) { System.exit(0); }
	    });
	    f.getContentPane().add("Center", capturePlayback);
	    f.pack();
	    Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
	    int w = 800;
	    int h = 400;
	    f.setLocation(screenSize.width/2 - w/2, screenSize.height/2 - h/2);
	    f.setSize(w, h);
	    f.show();
	}

}
